﻿using System;
using Autodesk.Revit.DB;
using YJKRevitBase.AsyncUtility.AsyncSupport;

namespace YJKRevitKernel.SampleAndTest.HalfNSquareSupportTest
{
	internal class InterModelCurve : IElement
	{
		public ModelCurve ThisElement
		{
			get
			{
				return this.m_thisElement;
			}
			set
			{
				this.m_thisElement = value;
			}
		}

		public InterModelCurve(ModelCurve inputCurve)
		{
			this.ThisElement = inputCurve;
		}

		public object Interactive(IElement anotherElement)
		{
			InterModelCurve interModelCurve;
			try
			{
				interModelCurve = (InterModelCurve)anotherElement;
			}
			catch (Exception)
			{
				return false;
			}
			IntersectionResultArray intersectionResultArray = new IntersectionResultArray();
			this.ThisElement.GeometryCurve.Intersect(interModelCurve.ThisElement.GeometryCurve, out intersectionResultArray);
			return intersectionResultArray != null && !intersectionResultArray.IsEmpty;
		}

		private ModelCurve m_thisElement;
	}
}
